package com.codingfly.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedHashMap;
import java.util.Map;

@RestController
@RequestMapping(value = "/v1")
public class HelloController {

    @Value("${spring.cloud.nacos.discovery.metadata.desc}")
    private String desc;

    @GetMapping(value="/info")
    public Map<String, String> info() {
        Map<String,String> metaData = new LinkedHashMap<>();
        metaData.put("desc", desc);
        return metaData;
    }

    @GetMapping(value="/test")
    public Map<String, Object> test() {
        Map<String, Object> map = new LinkedHashMap<>();
        map.put("code", 200);
        return map;
    }

}
